package com.invengo.library_orionstar;

import android.os.Build;

import com.ainirobot.coreservice.client.speech.SkillApi;

public class SkillApiHelper {

    //APPID是申请注册的APPID，也即使申请的opk的appid。
    private static final String SPEECH_APPID = "c6826aaf05044597446689deb8fc850f";
    //在接待后台注册的场景，语音会在正确的appi的中某个场景中生效
    private static final String SPEECH_DEFAULT_PATH = "yyyy";
    //在接待后台注册的版本号，没有实际的opk填1.0.0
    private static final String SPEECH_VERSION = "1.0.0";


    private static SkillApi mSkillApi;

    public static void setSkillApi(SkillApi skillApi)
    {
        mSkillApi = skillApi;
    }

    public static void startApp()
    {
        if(mSkillApi != null){
            mSkillApi.onCreate(SPEECH_APPID);
            mSkillApi.setVersion(SPEECH_APPID, SPEECH_VERSION);
            mSkillApi.setPath(SPEECH_APPID,SPEECH_DEFAULT_PATH);
            mSkillApi.onForeground(SPEECH_APPID);
        }
    }
    public static void moveToForeground()
    {
        if(mSkillApi != null){
            mSkillApi.onForeground(SPEECH_APPID);
        }
    }
    public static void moveToBack()
    {
        if(mSkillApi != null){
            mSkillApi.onBackground(SPEECH_APPID);
        }
    }
    public static void destroyApp(){
        if(mSkillApi != null){
            mSkillApi.onDestroy(SPEECH_APPID);
        }
    }
    public static void setAppPath(String path){
        if(mSkillApi != null){
            mSkillApi.setPath(SPEECH_APPID,path);
        }
    }
    public static void reset(){
        if(mSkillApi != null){
            mSkillApi.resetNlpState();
        }
    }
}
